#pragma once

#include "QvCommon.h"
#include "QvObject.h"
#include "QvString.h"
#include "QvMemoryStream.h"

typedef enum
{
    FileAttribute_Normal = 0,
    FileAttribute_Readonly = 1,
    FileAttribute_Hidden = 2,
    FileAttribute_Directory = 16
} FileAttribute;

class QvToolkit_Export QvFile : public QvObject
{
private:
    QvFile();

public:
    virtual ~QvFile(void);

public:
    static QvBoolean IsFileExist(const QvChar* strFullPath);

    static QvBoolean IsHidden(const QvChar* strFullPath);

    static QvBoolean IsReadOnly(const QvChar* strFullPath);

    static QvBoolean Create(const QvChar* strFullPath);

    static QvBoolean Delete(const QvChar* strFullPath);

    static QvBoolean GetFileSize(const QvChar* strFullPath, QvBigInteger& ln);

    static QvBoolean MoveTo(const QvChar* strOld, const QvChar* strNew);

    static QvBoolean CopyTo(const QvChar* strOld, const QvChar* strNew);

    static QvBoolean RenameTo(const QvChar* strFullPath, const QvChar* strNewName);

    static QvBoolean HaveAttribute(const QvChar* strFullPath, FileAttribute eAttr);

    static QvBoolean SetAttribute(const QvChar* strFullPath, FileAttribute eAttr);

    /*  nAccessMode:
    00   Existence only
    02   Write-only
    04   Read-only
    06   Read and write
    */
    static QvBoolean CheckFileAccess(const QvChar* strFilePath, QvInt32 nAccessMode);

    static QvMemoryStream* LoadFile(const QvChar* strFilePath);

    static QvBoolean WriteFile(const QvChar* strFilePath, const QvByte* data, QvInt32 nLength = -1);
};

